@model OrchardCore.Themes.Models.SelectThemesViewModel
<style asp-src="~/OrchardCore.Themes/Styles/themes.admin.css"></style>
<div class="alert alert-warning">
    <h4>@T["Changing default themes"]</h4>
    <p>@T["This page lets you change the site's default themes for both the front-end and the back-end."]</p>
</div>

@if (!Model.Themes.Any())
{
    <p>@T["There are no themes installed."]</p>
}
else
{
    <div class="row">
        @foreach (var themeEntry in Model.Themes)
        {
            <div class="col-sm-12 col-md-6 col-lg-4 d-flex align-items-stretch">
                <div class="card theme-card w-100">
                    <h4 class="card-title">@themeEntry.Name</h4>
                    <div class="card-theme-thumbnail" style="background-image:url('@Url.Content($"~/{themeEntry.Extension.Id}/Theme.png")');"></div>
                    <div class="card-body">
                        <p>@themeEntry.Extension.Manifest.Description</p>
                        @if (!string.IsNullOrWhiteSpace(themeEntry.Extension.Manifest.Author))
                        {
                            <small>@T["By: {0}", themeEntry.Extension.Manifest.Author]</small><br />
                        }
                        @if (!string.IsNullOrWhiteSpace(themeEntry.Extension.Manifest.Website))
                        {
                            <small><a href="@themeEntry.Extension.Manifest.Website" target="_blank">@themeEntry.Extension.Manifest.Website</a></small><br />
                        }
                        <small>@T["Version: {0}", themeEntry.Extension.Manifest.Version]</small>
                    </div>
                    <div class="card-footer text-muted text-xs-right">
                        @if (!themeEntry.IsCurrent)
                        {
                            <div class="row">
                                <div class="col-sm-6">
                                    <form asp-route-action="SetCurrentTheme" asp-route-id="@themeEntry.Extension.Id" method="post">
                                        <button type="submit" class="btn btn-sm btn-primary">@T["Make Default"]</button>
                                    </form>
                                </div>
                                <div class="col-sm-6">
                                    <div class="pull-right">
                                        @if (themeEntry.Enabled)
                                        {
                                            <form asp-route-action="Disable" asp-route-id="@themeEntry.Extension.Id" method="post">
                                                <button type="submit" class="btn btn-sm btn-secondary">@T["Disable"]</button>
                                            </form>
                                        }
                                        else
                                        {
                                            <form asp-route-action="Enable" asp-route-id="@themeEntry.Extension.Id" method="post">
                                                <button type="submit" class="btn btn-sm btn-secondary">@T["Enable"]</button>
                                            </form>
                                        }
                                    </div>
                                </div>
                            </div>
                        }
                        else
                        {
                            @T["This is the default {0} theme", themeEntry.IsAdmin ? "Admin" : "Site"]
                        }
                    </div>
                </div>
            </div>
        }
    </div>

    <div class="alert alert-danger">
        <h4>@T["Reset default themes"]</h4>
        <p>@T["The following actions reset the themes. It is used for sites that can't use theming."]</p>
        <a asp-action="ResetSiteTheme" itemprop="UnsafeUrl RemoveUrl" data-title="@T["Reset Site Theme"]" data-message="@T["Are you sure you want to reset the Site theme?"]" class="btn btn-danger">@T["Reset Site Theme"]</a>
        <a asp-action="ResetAdminTheme" itemprop="UnsafeUrl RemoveUrl" data-title="@T["Reset Admin Theme"]" data-message="@T["Are you sure you want to reset the Admin theme?"]" class="btn btn-danger">@T["Reset Admin Theme"]</a>
    </div>
}